Repository navigation
[CI] (0ae2102) react-router/shopper - #1239
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a React Router v7 (framework mode) e-commerce "Shopper" app. It adds client-side initialization via
Confidence score: 5/5 🧙
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | All syntax is valid, dependencies added, configs correct |
| Preserves existing env vars & configs | Yes | Existing code in root.tsx and route files preserved; only PostHog additions |
| No syntax or type errors | Yes | TypeScript/JSX syntax is correct throughout |
| Correct imports/exports | Yes | All imports from posthog-js, @posthog/react, posthog-node, and react-router are correct |
| Minimal, focused changes | Yes | All changes relate to PostHog integration |
| Pre-existing issues | None | Base app appears clean |
Issues
- Vite proxy is dev-only: The
server.proxyinvite.config.tsonly functions during local development withvite dev. Production builds served via@react-router/servewon't have this proxy. Theposthog.init()also doesn't pointapi_hostto/ingest, so the proxy is effectively unused even in dev. [MEDIUM]
Other completed criteria
- Environment variables documented via
.env.localpattern (usesVITE_PUBLIC_POSTHOG_PROJECT_TOKENandVITE_PUBLIC_POSTHOG_HOST) - Build configuration is valid — SSR
noExternalcorrectly configured for posthog-js and @posthog/react - react-router.config.ts correctly enables middleware with
future: { v8_middleware: true }
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.369.0, @posthog/react@^1.9.0, and posthog-node@^5.29.2 added to package.json |
| PostHog client initialized | Yes | Client: posthog.init() in entry.client.tsx with env vars, defaults, and tracing headers. Server: new PostHog() in middleware with flushAt: 1, flushInterval: 0 |
| capture() | Yes | 9 meaningful capture calls across 4 route files |
| identify() | No | No posthog.identify() call found anywhere — no user identification on login or page load |
| Error tracking | Yes | posthog.captureException(error) in ErrorBoundary in root.tsx |
| Reverse proxy | No | Vite server.proxy is dev-only and api_host in posthog.init() is not set to /ingest, so the proxy is never actually used |
Issues
- No user identification: There is no
posthog.identify()call anywhere in the codebase. The PostHog docs explicitly state "Identifying users is required." Without identify, all events are anonymous and cannot be associated with specific users across sessions. This is especially important for an e-commerce app where understanding per-user purchase behavior is critical. [CRITICAL] - Reverse proxy not functional: The Vite dev server proxy at
/ingestis configured, butposthog.init()setsapi_hostto the raw PostHog host URL, not/ingest. The proxy is never hit. In production, Vite'sserver.proxydoesn't exist at all. A proper production reverse proxy (e.g., via React Router server middleware or hosting rewrites) is needed, andapi_hostshould be set to/ingestto use it. [MEDIUM]
Other completed criteria
- API key loaded from environment variables (
import.meta.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKENon client,process.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKENon server) - API host correctly configured from environment variables
- Server-side middleware correctly extracts session/distinct ID headers and uses
posthog.withContext() - Tracing headers enabled with
__add_tracing_headersfor client-server correlation posthog.shutdown()called after middleware completes
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
app/routes/products..tsx |
product_viewed, product_added_to_cart |
Top-of-funnel product detail view and add-to-cart action with product properties |
app/routes/products.tsx |
product_added_to_cart_from_listing, product_searched, category_filter_changed |
Product listing interactions including search and category filtering |
app/routes/cart.tsx |
product_removed_from_cart, cart_quantity_updated, checkout_started |
Cart management events with item details and cart totals |
app/routes/checkout.tsx |
order_placed |
Bottom-of-funnel purchase completion with order total and items |
app/root.tsx |
captureException |
Unhandled error tracking via ErrorBoundary |
Issues
product_searchedfires too frequently: The search event fires on every call tohandleSearch, which is likely triggered on every keystroke. This will flood PostHog with noisy, incomplete search terms. Should debounce or capture on form submit / blur instead. [MEDIUM]
Other completed criteria
- Events represent real user actions mapping to a complete e-commerce funnel (view → add to cart → checkout → purchase)
- Events enable product insights — a full purchase funnel can be built from
product_viewed→product_added_to_cart→checkout_started→order_placed - Events include rich contextual properties (product_id, product_name, category, price, quantity, cart totals, item arrays)
- No PII in event properties — no emails, names, or personal data in capture calls
- Event names are descriptive, consistent snake_case, and clearly describe the action
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: wizard-pr
Trigger ID:
0ae2102App:
react-router/shopperApp directory:
apps/react-router/shopperWorkbench branch:
wizard-ci-0ae2102-react-router-shopperWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-04-15T19:35:03.034Z
Duration: 313.7s